package com.e3.web.widget.client;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.widget.Component;

/**
 * 
 * @author Administrator
 *
 */
public class BaseAction {
	
	private String icon="";
	
	private String text = "";
	
	private Object source;
	
	private String transactionNo;
	
	private List<Component> components = new ArrayList<Component>();
	
	public BaseAction(){
		
	}
	
	public BaseAction(String text){
		this.text = text;
	}
	
	public BaseAction(String text,String icon){
		this.text = text;
		this.icon = icon;
	}
	
	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Object getSource() {
		return source;
	}

	public void setSource(Object source) {
		this.source = source;
	}

	protected String getTransactionNo() {
		return transactionNo;
	}

	protected void setTransactionNo(String transactionNo) {
		this.transactionNo = transactionNo;
	}

	public List<Component> getComponents() {
		return components;
	}

	public void setComponents(List<Component> components) {
		this.components = components;
	}

	public void setEnable(boolean enable){
		for (Component component : components) {
			if(component!=null){
				component.setEnabled(enable);
			}
		}
	}
	
	public void addComponent(Component component){
		if(!components.contains(component)){
			components.add(component);
		}
	}
	
}
